home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DOS.SWG / 0068_System Reboot.pas < prev    next >
Pascal/Delphi Source File  |  1994-08-24  |  2KB  |  48 lines

  1. (*
  2.   System reset via software...
  3.  
  4.   Using a jump to address $FFFF:0000 doesn't always work to reboot
  5.   a system, particularly under multi-taskers. In a Windows 3.1 DOS-
  6.   session I get a dialog box, about a system violation, that tells
  7.   me to shut down all applications and restart the system -- but my
  8.   PC is certainly not reset by the software reboot attempt.
  9.  
  10.   AT-class systems ('286+) have a system controller IC which can be
  11.   instructed to reset the system. This will force a reboot even under
  12.   Windows.  The following TP code illustrates this process.
  13.  
  14.   Since this type of reset will interrupt all other processes, it's
  15.   important that an application first close all files and flush all
  16.   buffers. It would also be a good idea to ask the user if a entire
  17.   system reset is okay. Use this "power reset" prudently! ...
  18. *)
  19. (*******************************************************************)
  20.  
  21. PROGRAM Reboot;     { TP system reboot: Jul.19.94 Greg Vigneault    }
  22.  
  23. PROCEDURE SoftReset;                    { software reset for PC/XTs }
  24.   BEGIN                                 { invalid for multi-taskers }
  25.     InLine( $2B/$C0/                    {   sub   ax, ax            }
  26.             $8E/$C0/                    {   mov   es, ax            }
  27.             $26/$C7/6/$72/4/$34/$12/    {   mov   es:[472h],1234h   }
  28.             $EA/0/0/$FF/$FF);           {   jmp   0FFFFh:0000h      }
  29.   END {SoftReset};
  30.  
  31. PROCEDURE HardReset;                    { hardware reset for '286+  }
  32.   BEGIN                                 { (uses system controller)  }
  33.     InLine( $B0/$FE/                    {   mov   al, 0FEh          }
  34.             $E6/$64);                   {   out   64h, al           }
  35.   END {HardReset};
  36.  
  37.  
  38. BEGIN {Reboot}
  39.  
  40.   WriteLn; WriteLn('POWER RESET courtesy Greg Vigneault...');
  41.   HardReset;
  42.   { if we're still running then the system is probably a PC/XT...   }
  43.   SoftReset;
  44.  
  45. END {Reboot}.
  46. {       Internet(Greg.Vigneault@westonia.com) Fido(1:250/636)       }
  47. (*******************************************************************)
  48.